Optimal. Leaf size=86 \[ -\frac {5 a^2 \tanh ^{-1}(\cos (c+d x))}{2 d}-\frac {2 a^2 \cot (c+d x)}{d}+\frac {5 a^2 \sec (c+d x)}{2 d}-\frac {a^2 \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {2 a^2 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.15, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps
used = 12, number of rules used = 7, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.241, Rules used = {2952, 2702,
327, 213, 2700, 14, 294} \begin {gather*} \frac {2 a^2 \tan (c+d x)}{d}-\frac {2 a^2 \cot (c+d x)}{d}+\frac {5 a^2 \sec (c+d x)}{2 d}-\frac {5 a^2 \tanh ^{-1}(\cos (c+d x))}{2 d}-\frac {a^2 \csc ^2(c+d x) \sec (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 14
Rule 213
Rule 294
Rule 327
Rule 2700
Rule 2702
Rule 2952
Rubi steps
\begin {align*} \int \csc ^3(c+d x) \sec ^2(c+d x) (a+a \sin (c+d x))^2 \, dx &=\int \left (a^2 \csc (c+d x) \sec ^2(c+d x)+2 a^2 \csc ^2(c+d x) \sec ^2(c+d x)+a^2 \csc ^3(c+d x) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 \int \csc (c+d x) \sec ^2(c+d x) \, dx+a^2 \int \csc ^3(c+d x) \sec ^2(c+d x) \, dx+\left (2 a^2\right ) \int \csc ^2(c+d x) \sec ^2(c+d x) \, dx\\ &=\frac {a^2 \text {Subst}\left (\int \frac {x^4}{\left (-1+x^2\right )^2} \, dx,x,\sec (c+d x)\right )}{d}+\frac {a^2 \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{d}+\frac {\left (2 a^2\right ) \text {Subst}\left (\int \frac {1+x^2}{x^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {a^2 \sec (c+d x)}{d}-\frac {a^2 \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {a^2 \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{d}+\frac {\left (3 a^2\right ) \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{2 d}+\frac {\left (2 a^2\right ) \text {Subst}\left (\int \left (1+\frac {1}{x^2}\right ) \, dx,x,\tan (c+d x)\right )}{d}\\ &=-\frac {a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac {2 a^2 \cot (c+d x)}{d}+\frac {5 a^2 \sec (c+d x)}{2 d}-\frac {a^2 \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {2 a^2 \tan (c+d x)}{d}+\frac {\left (3 a^2\right ) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{2 d}\\ &=-\frac {5 a^2 \tanh ^{-1}(\cos (c+d x))}{2 d}-\frac {2 a^2 \cot (c+d x)}{d}+\frac {5 a^2 \sec (c+d x)}{2 d}-\frac {a^2 \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {2 a^2 \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.77, size = 124, normalized size = 1.44 \begin {gather*} \frac {a^2 \left (-8 \cot \left (\frac {1}{2} (c+d x)\right )-\csc ^2\left (\frac {1}{2} (c+d x)\right )-20 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+20 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+\sec ^2\left (\frac {1}{2} (c+d x)\right )+\frac {32 \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+8 \tan \left (\frac {1}{2} (c+d x)\right )\right )}{8 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.22, size = 117, normalized size = 1.36
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+2 a^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )+a^{2} \left (\frac {1}{\cos \left (d x +c \right )}+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )}{d}\) | \(117\) |
default | \(\frac {a^{2} \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+2 a^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )+a^{2} \left (\frac {1}{\cos \left (d x +c \right )}+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )}{d}\) | \(117\) |
risch | \(\frac {a^{2} \left (-5 i {\mathrm e}^{3 i \left (d x +c \right )}+5 \,{\mathrm e}^{4 i \left (d x +c \right )}+3 i {\mathrm e}^{i \left (d x +c \right )}-11 \,{\mathrm e}^{2 i \left (d x +c \right )}+8\right )}{\left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2} \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) d}+\frac {5 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}-\frac {5 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}\) | \(124\) |
norman | \(\frac {\frac {a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a^{2} \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a^{2}}{8 d}-\frac {4 a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {10 a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {4 a^{2} \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a^{2} \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}-\frac {15 a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}-\frac {35 a^{2} \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}-\frac {65 a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {5 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}\) | \(238\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 124, normalized size = 1.44 \begin {gather*} \frac {a^{2} {\left (\frac {2 \, {\left (3 \, \cos \left (d x + c\right )^{2} - 2\right )}}{\cos \left (d x + c\right )^{3} - \cos \left (d x + c\right )} - 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + 2 \, a^{2} {\left (\frac {2}{\cos \left (d x + c\right )} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 8 \, a^{2} {\left (\frac {1}{\tan \left (d x + c\right )} - \tan \left (d x + c\right )\right )}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 300 vs.
\(2 (80) = 160\).
time = 0.35, size = 300, normalized size = 3.49 \begin {gather*} \frac {16 \, a^{2} \cos \left (d x + c\right )^{3} + 10 \, a^{2} \cos \left (d x + c\right )^{2} - 14 \, a^{2} \cos \left (d x + c\right ) - 8 \, a^{2} - 5 \, {\left (a^{2} \cos \left (d x + c\right )^{3} + a^{2} \cos \left (d x + c\right )^{2} - a^{2} \cos \left (d x + c\right ) - a^{2} - {\left (a^{2} \cos \left (d x + c\right )^{2} - a^{2}\right )} \sin \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 5 \, {\left (a^{2} \cos \left (d x + c\right )^{3} + a^{2} \cos \left (d x + c\right )^{2} - a^{2} \cos \left (d x + c\right ) - a^{2} - {\left (a^{2} \cos \left (d x + c\right )^{2} - a^{2}\right )} \sin \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 2 \, {\left (8 \, a^{2} \cos \left (d x + c\right )^{2} + 3 \, a^{2} \cos \left (d x + c\right ) - 4 \, a^{2}\right )} \sin \left (d x + c\right )}{4 \, {\left (d \cos \left (d x + c\right )^{3} + d \cos \left (d x + c\right )^{2} - d \cos \left (d x + c\right ) - {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right ) - d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: SystemError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.47, size = 116, normalized size = 1.35 \begin {gather*} \frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 20 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 8 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {32 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1} - \frac {30 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 8 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}}}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.96, size = 124, normalized size = 1.44 \begin {gather*} \frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}+\frac {5\,a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{2\,d}+\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d}-\frac {-20\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+\frac {7\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2}+\frac {a^2}{2}}{d\,\left (4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________